home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Timing.h
-
- Contains: Kernel Timing Interfaces.
-
- Version: Technology: System 8
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- */
- #ifndef __TIMING__
- #define __TIMING__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import on
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=power
- /* the following contents can only be used by compilers that support PowerPC struct alignment */
-
- #if FOR_SYSTEM8_PREEMPTIVE
-
- enum {
- kDurationMicrosecond = -1L, /* Microseconds are negative */
- kDurationMillisecond = 1L, /* Milliseconds are positive*/
- kDurationSecond = 1000L, /* 1000 * durationMillisecond*/
- kDurationMinute = 60000L, /* 60 * durationSecond,*/
- kDurationHour = 3600000L, /* 60 * durationMinute,*/
- kDurationDay = 86400000L, /* 24 * durationHour,*/
- kDurationNoWait = 0L, /* don't block*/
- kDurationForever = 0x7FFFFFFF /* no time limit*/
- };
-
- #if OLDROUTINENAMES
-
- enum {
- durationMicrosecond = kDurationMicrosecond,
- durationMillisecond = kDurationMillisecond,
- durationSecond = kDurationSecond,
- durationMinute = kDurationMinute,
- durationHour = kDurationHour,
- durationDay = kDurationDay,
- durationNoWait = kDurationNoWait,
- durationForever = kDurationForever
- };
-
- #endif
- typedef UInt64 Nanoseconds;
- typedef UInt32 Ticks;
- /*
- Time Information Routines
- */
- extern AbsoluteTime UpTime(void );
-
- extern AbsoluteTime TaskCPUTime(void );
-
- extern void GetTimeBaseInfo(UInt32 *theMinAbsoluteTimeDelta, UInt32 *theAbsoluteTimeToNanosecondNumerator, UInt32 *theAbsoluteTimeToNanosecondDenominator, UInt32 *theProcessorToAbsoluteTimeNumerator, UInt32 *theProcessorToAbsoluteTimeDenominator);
-
- /*
- Timing Conversion Routines
- */
- extern Nanoseconds AbsoluteToNanoseconds(AbsoluteTime theAbsoluteTime);
-
- extern Duration AbsoluteToDuration(AbsoluteTime theAbsoluteTime);
-
- extern AbsoluteTime NanosecondsToAbsolute(Nanoseconds theNanoseconds);
-
- extern AbsoluteTime DurationToAbsolute(Duration theDuration);
-
- extern Nanoseconds DurationToNanoseconds(Duration theDuration);
-
- extern Duration NanosecondsToDuration(Nanoseconds theNanoseconds);
-
- extern Ticks AbsoluteToTicks(AbsoluteTime theAbsoluteTime);
-
- extern AbsoluteTime TicksToAbsolute(Ticks theTicks);
-
- /*
- AbsoluteTime Adjustment Routines
- */
- extern AbsoluteTime AddAbsoluteToAbsolute(AbsoluteTime theAbsoluteTime1, AbsoluteTime theAbsoluteTime2);
-
- extern AbsoluteTime SubAbsoluteFromAbsolute(AbsoluteTime theLeftAbsoluteTime, AbsoluteTime theRightAbsoluteTime);
-
- extern AbsoluteTime AddNanosecondsToAbsolute(Nanoseconds theNanoseconds, AbsoluteTime theAbsoluteTime);
-
- extern AbsoluteTime AddDurationToAbsolute(Duration theDuration, AbsoluteTime theAbsoluteTime);
-
- extern AbsoluteTime SubNanosecondsFromAbsolute(Nanoseconds theNanoseconds, AbsoluteTime theAbsoluteTime);
-
- extern AbsoluteTime SubDurationFromAbsolute(Duration theDuration, AbsoluteTime theAbsoluteTime);
-
- /*
- Timing Delta Routines
- */
- extern Nanoseconds AbsoluteDeltaToNanoseconds(AbsoluteTime theLeftAbsoluteTime, AbsoluteTime theRightAbsoluteTime);
-
- extern Duration AbsoluteDeltaToDuration(AbsoluteTime theLeftAbsoluteTime, AbsoluteTime theRightAbsoluteTime);
-
- #endif
-
- #pragma options align=reset
- #endif /* PRAGMA_ALIGN_SUPPORTED */
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import off
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __TIMING__ */
-
-